import { loc_tag } from '../../nui';

var filefy = require("filefy");

/* col: ["a", "b", "c"]
 * row: [["a2", "b1", "c1"]]
*/
const export_csv_file = (fileName, col, row) => {
    let builder = new filefy.CsvBuilder(fileName + ".csv");

    builder.setDelimeter(",").setColumns(col).addRows(row).exportFile();
};

/* data: [
 *      ["a", "b", "c"],
 * ]
*/
const export_data_single = (name, data) => {
    const fn = name + "_" + loc_tag();

    let builder = new filefy.CsvBuilder(fn + ".csv");
    builder.setDelimeter(",").addRows(data).exportFile();
};

export {export_data_single, export_csv_file};
